Configure NIS Server
2016/05/25 |
Configure NIS Server in order to share users' accounts in your local networks.
|
|
[1] | Install NIS. |
root@dlp:~#
apt-get -y install nis
Preconfiguring packages ...
# input domain name # Autostart NIS during installation will be fail because configuration is none yet, so wait for a moment to finish it. +----------------------------| Configuring nis |----------------------------+ | Please choose the NIS "domainname" for this system. If you want this | | machine to just be a client, you should enter the name of the NIS domain | | you wish to join. | | | | Alternatively, if this machine is to be a NIS server, you can either | | enter a new NIS "domainname" or the name of an existing NIS domain. | | | | NIS domain: | | | | srv.world_____________________________________________________________ | | | | <Ok> | | | +---------------------------------------------------------------------------+ |
[2] | Configure as a NIS master Server. |
root@dlp:~#
vi /etc/default/nis # line 6: change (set NIS master server) NISSERVER= master
root@dlp:~#
vi /etc/ypserv.securenets
# This line gives access to everybody. PLEASE ADJUST!
# comment out # 0.0.0.0 0.0.0.0
# add to the end: IP range you allow to access 255.255.255.0 10.0.0.0
root@dlp:~#
vi /var/yp/Makefile # line 52: change MERGE_PASSWD= true
# line 56: change MERGE_GROUP= true
root@dlp:~#
vi /etc/hosts 127.0.0.1 localhost # add own IP address for NIS 10.0.0.30 dlp.srv.world dlp
root@dlp:~#
systemctl restart nis
# update NIS database root@dlp:~# /usr/lib/yp/ypinit -m At this point, we have to construct a list of the hosts which will run NIS servers. dlp is in the list of NIS server hosts. Please continue to add the names for the other hosts, one per line. When you are done with the list, type a <control D>. next host to add: dlp.srv.worldnext host to add: # Ctrl+D key The current list of NIS servers looks like this: dlpIs this correct? [y/n: y] y We need a few minutes to build the databases... Building /var/yp/srv.world/ypservers... Running /var/yp/Makefile... make[1]: Entering directory '/var/yp/srv.world' Updating passwd.byname... Updating passwd.byuid... Updating group.byname... Updating group.bygid... Updating hosts.byname... Updating hosts.byaddr... Updating rpc.byname... Updating rpc.bynumber... Updating services.byname... Updating services.byservicename... Updating netid.byname... Updating protocols.bynumber... Updating protocols.byname... Updating netgroup... Updating netgroup.byhost... Updating netgroup.byuser... Updating shadow.byname... Ignored -> merged with passwd make[1]: Leaving directory '/var/yp/srv.world' dlp.srv.world has been set up as a NIS master server. Now you can run ypinit -s dlp.srv.world on all slave server. |
[3] | If you added users in local server, apply them to NIS database, too. |
root@dlp:~# cd /var/yp root@dlp:/var/yp# make
|